home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 August: Tool Chest / Dev.CD Aug 00 TC Disk 1.toast / pc / sample code / contributed / waste / waste c.c++ headers / waste.h < prev   
Encoding:
C/C++ Source or Header  |  2000-06-23  |  41.0 KB  |  882 lines

  1. /*
  2.  *    WASTE.h
  3.  *
  4.  *    C/C++ interface to the WASTE text engine
  5.  *
  6.  *    version 1.3 (January 1998)
  7.  *
  8.  *    Copyright (c) 1993-1998 Marco Piovanelli
  9.  *    All Rights Reserved
  10.  *
  11.  */
  12.  
  13. #ifndef _WASTE_
  14. #define _WASTE_
  15.  
  16. #ifndef __CONDITIONALMACROS__
  17. #include <ConditionalMacros.h>
  18. #endif
  19.  
  20. #ifndef UNIVERSAL_INTERFACES_VERSION
  21. #error "You need Universal Headers version 2.1 or newer to use WASTE.h"
  22. #endif
  23.  
  24. #ifndef __TYPES__
  25. #include <Types.h>
  26. #endif
  27.  
  28. #ifndef __MIXEDMODE__
  29. #include <MixedMode.h>
  30. #endif
  31.  
  32. #ifndef __QUICKDRAWTEXT__
  33. #include <QuickdrawText.h>
  34. #endif
  35.  
  36. #ifndef __QUICKDRAW__
  37. #include <Quickdraw.h>
  38. #endif
  39.  
  40. #ifndef __SCRIPT__
  41. #include <Script.h>
  42. #endif
  43.  
  44. #ifndef __TEXTUTILS__
  45. #include <TextUtils.h>
  46. #endif
  47.  
  48. #ifndef __TEXTEDIT__
  49. #include <TextEdit.h>
  50. #endif
  51.  
  52. #ifndef __DRAG__
  53. #include <Drag.h>
  54. #endif
  55.  
  56. #ifndef __LONGCOORDINATES__
  57. #ifndef _LongCoords_
  58. #include "LongCoords.h"
  59. #endif
  60. #endif
  61.  
  62. #ifdef __cplusplus
  63. extern "C" {
  64. #endif
  65.  
  66. #if PRAGMA_ALIGN_SUPPORTED
  67. #pragma options align=mac68k
  68. #endif
  69.  
  70. #if PRAGMA_IMPORT_SUPPORTED
  71. #pragma import on
  72. #endif
  73.  
  74. //    The macro WASTE_VERSION expands to the current version of WASTE,
  75. //    expressed in standard NumVersion format (see Types.h)
  76. //    The macro WASTE11 is obsolete but still supported for backward
  77. //    compatibility
  78.  
  79. #define WASTE_VERSION    0x01308000        /* 1.3 */
  80. #define WASTE11
  81.  
  82. /*    result codes */
  83.  
  84. enum
  85. {
  86.     weCantUndoErr            =    -10015,    /* undo buffer is clear (= errAECantUndo) */
  87.     weEmptySelectionErr        =    -10013,    /* selection range is empty (= errAENoUserSelection) */
  88.     weNotHandledErr            =    -1708,    /* please use default behavior (= errAEEventNotHandled) */
  89.     weUnknownObjectTypeErr    =    -9478,    /* specified object type is not registered */
  90.     weObjectNotFoundErr        =    -9477,    /* no object found at specified offset */
  91.     weReadOnlyErr            =    -9476,    /* instance is read-only */
  92.     weUndefinedSelectorErr    =    -50        /* unknown selector (= paramErr) */
  93. };
  94.  
  95. /*    alignment styles */
  96.  
  97. enum
  98. {
  99.     weFlushLeft         =    -2,        /* flush left */
  100.     weFlushRight        =    -1,        /* flush right */
  101.     weFlushDefault        =     0,        /* flush according to system direction */
  102.     weCenter            =     1,        /* centered */
  103.     weJustify            =     2        /* fully justified */
  104. };
  105.  
  106. /*    primary line direction */
  107.  
  108. enum
  109. {
  110.     weDirDefault        =     1,        /* according to system direction */
  111.     weDirRightToLeft    =    -1,        /* force right-to-left */
  112.     weDirLeftToRight    =     0        /* force left-to-right */
  113. };
  114.  
  115. /*    values for the mode parameter in WESetStyle and WEContinuousStyle */
  116.  
  117. enum
  118. {
  119.     weDoFont                =    0x0001,
  120.     weDoFace                =    0x0002,
  121.     weDoSize                =    0x0004,
  122.     weDoColor                =    0x0008,
  123.     weDoAll                    =    weDoFont + weDoFace + weDoSize + weDoColor,
  124.     weDoAddSize                =    0x0010,
  125.     weDoToggleFace            =    0x0020,
  126.     weDoReplaceFace            =    0x0040,
  127.     weDoPreserveScript        =    0x0080,
  128.     weDoExtractSubscript    =    0x0100,
  129.     weDoFaceMask            =    0x0200
  130. };
  131.  
  132. /*    values for the edge parameter in WEGetOffset etc. */
  133.  
  134. enum
  135. {
  136.     kLeadingEdge = -1,        /* point is on the leading edge of a glyph */
  137.     kTrailingEdge = 0,        /* point is on the trailing edge of a glyph */
  138.     kObjectEdge = 2            /* point is in the middle of an embedded object */
  139. };
  140.  
  141. /*    values for WEFeatureFlag feature parameter */
  142.  
  143. enum
  144. {
  145.     weFAutoScroll        =    0,        /* automatically scroll the selection range into view */
  146.     weFOutlineHilite    =    2,        /* frame selection when deactivated */
  147.     weFReadOnly            =    5,        /* disallow modifications */
  148.     weFUndo                =    6,        /* support WEUndo() */
  149.     weFIntCutAndPaste    =    7,        /* use intelligent cut-and-paste rules */
  150.     weFDragAndDrop        =    8,        /* support drag-and-drop text editing */
  151.     weFInhibitRecal        =    9,        /* don't recalculate line starts and don't redraw text */
  152.     weFUseTempMem        =    10,        /* use temporary memory for main data structures */
  153.     weFDrawOffscreen    =    11,        /* draw text offscreen for smoother visual results */
  154.     weFInhibitRedraw    =    12,        /* don't redraw text */
  155.     weFMonoStyled        =    13,        /* disallow style changes */
  156.     weFInhibitColor        =    31        /* draw in black & white only */
  157. };
  158.  
  159. /*    values for WENew flags parameter */
  160.  
  161. enum
  162. {
  163.     weDoAutoScroll        =    1L << weFAutoScroll,
  164.     weDoOutlineHilite    =    1L << weFOutlineHilite,
  165.     weDoReadOnly        =    1L << weFReadOnly,
  166.     weDoUndo            =    1L << weFUndo,
  167.     weDoIntCutAndPaste    =    1L << weFIntCutAndPaste,
  168.     weDoDragAndDrop        =    1L << weFDragAndDrop,
  169.     weDoInhibitRecal    =    1L << weFInhibitRecal,
  170.     weDoUseTempMem        =    1L << weFUseTempMem,
  171.     weDoDrawOffscreen    =    1L << weFDrawOffscreen,
  172.     weDoInhibitRedraw    =    1L << weFInhibitRedraw,
  173.     weDoMonoStyled        =    1L << weFMonoStyled,
  174.     weDoInhibitColor    =    1L << weFInhibitColor
  175. };
  176.  
  177. /*    values for WEFeatureFlag action parameter */
  178.  
  179. enum
  180. {
  181.     weBitToggle = -2,    /* toggles the specified feature */
  182.     weBitTest,            /* returns the current setting of the specified feature */
  183.     weBitClear,            /* disables the specified feature */
  184.     weBitSet            /* enables the specified feature */
  185. };
  186.  
  187. /*    selectors for WEGetInfo and WESetInfo */
  188.  
  189. enum
  190. {
  191.     weCharByteHook                =    'cbyt', /* CharByte hook */
  192.     weCharToPixelHook            =    'c2p ',    /* CharToPixel hook */
  193.     weCharTypeHook                =    'ctyp', /* CharType hook */
  194.     weClickLoop                    =    'clik',    /* click loop callback */
  195.     weCurrentDrag                =    'drag',    /* drag currently being tracked from WEClick() */
  196.     weDrawTextHook                =    'draw', /* text drawing hook */
  197.     weEraseHook                    =    'eras', /* background erasing hook */
  198.     weFluxProc                    =    'flux', /* flux proc */
  199.     weHiliteDropAreaHook        =    'hidr', /* drop area highlighting hook */
  200.     weLineBreakHook                =    'lbrk',    /* line breaking hook */
  201.     wePixelToCharHook            =    'p2c ', /* PixelToChar hook */
  202.     wePort                        =    'port',    /* graphics port */
  203.     wePreTrackDragHook            =    'ptrk', /* pre-TrackDrag hook */
  204.     weRefCon                    =    'refc',    /* reference constant for use by application */
  205.     weScrollProc                =    'scrl',    /* auto-scroll callback */
  206.     weText                        =    'text',    /* text handle */
  207.     weTranslateDragHook         =    'xdrg', /* drag translation callback */
  208.     weTranslucencyThreshold        =    'tluc', /* area threshold for translucent drags */
  209.     weTSMDocumentID                =    'tsmd',    /* Text Services Manager document ID */
  210.     weTSMPreUpdate                =    'pre ',    /* Text Services Manager pre-update callback */
  211.     weTSMPostUpdate                =    'post',    /* Text Services Manager post-update callback */
  212.     weURLHint                    =    'urlh',    /* URL hint string for Internet Config */
  213.     weWordBreakHook                =    'wbrk'    /* word breaking hook */
  214. };
  215.  
  216. /*    values for WEInstallObjectHandler handlerSelector parameter */
  217.  
  218. enum
  219. {
  220.     weNewHandler        =    'new ',        /* new handler */
  221.     weDisposeHandler    =    'free',        /* dispose handler */
  222.     weDrawHandler        =    'draw',        /* draw handler */
  223.     weClickHandler        =    'clik',        /* click handler */
  224.     weStreamHandler        =    'strm'        /* stream handler */
  225. };
  226.  
  227. /*    action kinds */
  228.  
  229. enum
  230. {
  231.     weAKNone            =    0,        /* null action */
  232.     weAKUnspecified        =    1,        /* action of unspecified nature */
  233.     weAKTyping            =    2,        /* some text has been typed in */
  234.     weAKCut                =    3,        /* the selection range has been cut */
  235.     weAKPaste            =    4,        /* something has been pasted */
  236.     weAKClear            =    5,        /* the selection range has been deleted */
  237.     weAKDrag            =    6,        /* drag and drop operation */
  238.     weAKSetStyle        =    7        /* some style has been applied to a text range */
  239. };
  240.  
  241. /*    destination kinds for stream handler */
  242.  
  243. enum
  244. {
  245.     weToScrap            =    0,
  246.     weToDrag            =    1,
  247.     weToSoup            =    2
  248. };
  249.  
  250. typedef struct OpaqueWEReference *WEReference;
  251. typedef struct OpaqueWEObjectReference *WEObjectReference;
  252. typedef Handle WESoupHandle;
  253. typedef Handle WEFontTableHandle;
  254. typedef SInt16 WEActionKind;
  255. typedef SInt8 WEAlignment;
  256. typedef SInt16 WEDirection;
  257. typedef SInt8 WEEdge;
  258. typedef UInt16 WEStyleMode;
  259. typedef FourCharCode WESelector;
  260. typedef WEReference WEHandle;    /* obsolete, kept for backward compatibility */
  261.  
  262. typedef struct WERunInfo
  263. {
  264.     SInt32                 runStart;    /* byte offset to first character of style run */
  265.     SInt32                 runEnd;        /* byte offset past last character of style run */
  266.     SInt16                 runHeight;    /* line height (ascent + descent + leading) */
  267.     SInt16                 runAscent;    /* font ascent */
  268.     TextStyle             runStyle;    /* text attributes */
  269.     WEObjectReference    runObject;    /* either nil or reference to embedded object */
  270. } WERunInfo;
  271.  
  272.  
  273. /*    callback prototypes */
  274.  
  275. typedef pascal Boolean (*WEClickLoopProcPtr)(WEReference we);
  276. typedef pascal void (*WEScrollProcPtr)(WEReference we);
  277. typedef pascal void (*WETSMPreUpdateProcPtr)(WEReference we);
  278. typedef pascal void (*WETSMPostUpdateProcPtr)(WEReference we,
  279.         SInt32 fixLength, SInt32 inputAreaStart, SInt32 inputAreaEnd,
  280.         SInt32 pinRangeStart, SInt32 pinRangeEnd);
  281. typedef pascal OSErr (*WEPreTrackDragProcPtr)(DragReference drag, WEReference we);
  282. typedef pascal OSErr (*WETranslateDragProcPtr)(DragReference theDrag,
  283.         ItemReference theItem, FlavorType requestedType, Handle putDataHere,
  284.         SInt32 dropOffset, WEReference we);
  285. typedef pascal OSErr (*WEHiliteDropAreaProcPtr)(DragReference theDrag,
  286.         Boolean hiliteFlag, WEReference we);
  287. typedef pascal OSErr (*WEFontIDToNameProcPtr)(SInt16 fontID, Str255 fontName);
  288. typedef pascal OSErr (*WEFontNameToIDProcPtr)(ConstStr255Param fontName, SInt16 oldFontID, SInt16 *newFontID);
  289. typedef pascal void (*WEDrawTextProcPtr)(Ptr pText, SInt32 textLength, Fixed slop,
  290.         JustStyleCode styleRunPosition, WEReference we);
  291. typedef pascal SInt32 (*WEPixelToCharProcPtr)(Ptr pText, SInt32 textLength, Fixed slop,
  292.         Fixed *pixelWidth, WEEdge *edge, JustStyleCode styleRunPosition, Fixed hPos, WEReference we);
  293. typedef pascal SInt16 (*WECharToPixelProcPtr)(Ptr pText, SInt32 textLength, Fixed slop,
  294.         SInt32 offset, SInt16 direction, JustStyleCode styleRunPosition, SInt16 hPos, WEReference we);
  295. typedef pascal StyledLineBreakCode (*WELineBreakProcPtr)(Ptr pText, SInt32 textLength,
  296.         SInt32 textStart, SInt32 textEnd, Fixed *textWidth, SInt32 *textOffset, WEReference we);
  297. typedef pascal void (*WEWordBreakProcPtr)(Ptr pText, SInt16 textLength, SInt16 offset,
  298.         WEEdge edge, OffsetTable breakOffsets, ScriptCode script, WEReference we);
  299. typedef pascal SInt16 (*WECharByteProcPtr)(Ptr pText, SInt16 textOffset, ScriptCode script,
  300.         WEReference we);
  301. typedef pascal SInt16 (*WECharTypeProcPtr)(Ptr pText, SInt16 textOffset, ScriptCode script, WEReference we);
  302. typedef pascal void (*WEEraseProcPtr)(const Rect *area, WEReference we);
  303. typedef pascal void (*WEFluxProcPtr)(SInt32 offset, SInt32 delta, WEReference we);
  304. typedef pascal OSErr (*WENewObjectProcPtr)(Point *defaultObjectSize,
  305.         WEObjectReference obj);
  306. typedef pascal OSErr (*WEDisposeObjectProcPtr)(WEObjectReference obj);
  307. typedef pascal OSErr (*WEDrawObjectProcPtr)(const Rect *destRect,
  308.         WEObjectReference obj);
  309. typedef pascal Boolean (*WEClickObjectProcPtr)(Point hitPt, EventModifiers modifiers, UInt32 clickTime,
  310.         WEObjectReference obj);
  311. typedef pascal OSErr (*WEStreamObjectProcPtr)(SInt16 destKind, FlavorType *theType,
  312.         Handle putDataHere, WEObjectReference obj);
  313.  
  314.  
  315. /*    UPP proc info */
  316.  
  317. enum
  318. {
  319.     uppWEClickLoopProcInfo = kPascalStackBased
  320.         | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  321.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(WEReference /*we*/))),
  322.     uppWEScrollProcInfo = kPascalStackBased
  323.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(WEReference /*we*/))),
  324.     uppWETSMPreUpdateProcInfo = kPascalStackBased
  325.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(WEReference /*we*/))),
  326.     uppWETSMPostUpdateProcInfo = kPascalStackBased
  327.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(WEReference /*we*/)))
  328.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt32 /*fixLength*/)))
  329.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(SInt32 /*inputAreaStart*/)))
  330.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(SInt32 /*inputAreaEnd*/)))
  331.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(SInt32 /*pinRangeStart*/)))
  332.         | STACK_ROUTINE_PARAMETER(6,SIZE_CODE(sizeof(SInt32 /*pinRangeEnd*/))),
  333.     uppWEPreTrackDragProcInfo = kPascalStackBased
  334.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  335.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(DragReference /*drag*/)))
  336.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(WEReference /*we*/))),
  337.     uppWETranslateDragProcInfo = kPascalStackBased
  338.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  339.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(DragReference /*theDrag*/)))
  340.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(ItemReference /*theItem*/)))
  341.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(FlavorType /*requestedType*/)))
  342.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(Handle /*putDataHere*/)))
  343.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(SInt32 /*dropOffset*/)))
  344.         | STACK_ROUTINE_PARAMETER(6,SIZE_CODE(sizeof(WEReference /*we*/))),
  345.     uppWEHiliteDropAreaProcInfo = kPascalStackBased
  346.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  347.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(DragReference /*theDrag*/)))
  348.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(Boolean /*hiliteFlag*/)))
  349.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(WEReference /*we*/))),
  350.     uppWEFontIDToNameProcInfo = kPascalStackBased
  351.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  352.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(SInt16 /*fontID*/)))
  353.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(StringPtr /*fontName*/))),
  354.     uppWEFontNameToIDProcInfo = kPascalStackBased
  355.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  356.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(ConstStr255Param /*fontName*/)))
  357.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt16 /*oldFontID*/)))
  358.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(SInt16 * /*newFontID*/))),
  359.     uppWEDrawTextProcInfo = kPascalStackBased
  360.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  361.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt32 /*textLength*/)))
  362.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(Fixed /*slop*/)))
  363.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(JustStyleCode /*styleRunPosition*/)))
  364.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(WEReference /*we*/))),
  365.     uppWEPixelToCharProcInfo = kPascalStackBased
  366.         | RESULT_SIZE(SIZE_CODE(sizeof(SInt32)))
  367.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  368.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt32 /*textLength*/)))
  369.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(Fixed /*slop*/)))
  370.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(Fixed * /*pixelWidth*/)))
  371.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(WEEdge * /*edge*/)))
  372.         | STACK_ROUTINE_PARAMETER(6,SIZE_CODE(sizeof(JustStyleCode /*styleRunPosition*/)))
  373.         | STACK_ROUTINE_PARAMETER(7,SIZE_CODE(sizeof(Fixed /*hPos*/)))
  374.         | STACK_ROUTINE_PARAMETER(8,SIZE_CODE(sizeof(WEReference /*we*/))),
  375.     uppWECharToPixelProcInfo = kPascalStackBased
  376.         | RESULT_SIZE(SIZE_CODE(sizeof(SInt16)))
  377.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  378.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt32 /*textLength*/)))
  379.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(Fixed /*slop*/)))
  380.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(SInt32 /*offset*/)))
  381.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(SInt16 /*direction*/)))
  382.         | STACK_ROUTINE_PARAMETER(6,SIZE_CODE(sizeof(JustStyleCode /*styleRunPosition*/)))
  383.         | STACK_ROUTINE_PARAMETER(7,SIZE_CODE(sizeof(SInt16 /*hPos*/)))
  384.         | STACK_ROUTINE_PARAMETER(8,SIZE_CODE(sizeof(WEReference /*we*/))),
  385.     uppWELineBreakProcInfo = kPascalStackBased
  386.         | RESULT_SIZE(SIZE_CODE(sizeof(StyledLineBreakCode )))
  387.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  388.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt32 /*textLength*/)))
  389.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(SInt32 /*textStart*/)))
  390.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(SInt32 /*textEnd*/)))
  391.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(Fixed * /*textWidth*/)))
  392.         | STACK_ROUTINE_PARAMETER(6,SIZE_CODE(sizeof(SInt32 * /*textOffset*/)))
  393.         | STACK_ROUTINE_PARAMETER(7,SIZE_CODE(sizeof(WEReference /*we*/))),
  394.     uppWEWordBreakProcInfo = kPascalStackBased
  395.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  396.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt16 /*textLength*/)))
  397.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(SInt16 /*offset*/)))
  398.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(WEEdge /*edge*/)))
  399.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(OffsetTable * /*breakOffsets*/)))
  400.         | STACK_ROUTINE_PARAMETER(6,SIZE_CODE(sizeof(ScriptCode /*script*/)))
  401.         | STACK_ROUTINE_PARAMETER(7,SIZE_CODE(sizeof(WEReference /*we*/))),
  402.     uppWECharByteProcInfo = kPascalStackBased
  403.         | RESULT_SIZE(SIZE_CODE(sizeof(SInt16 )))
  404.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  405.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt16 /*textOffset*/)))
  406.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(ScriptCode /*script*/)))
  407.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(WEReference /*we*/))),
  408.     uppWECharTypeProcInfo = kPascalStackBased
  409.         | RESULT_SIZE(SIZE_CODE(sizeof(SInt16 )))
  410.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  411.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt16 /*textOffset*/)))
  412.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(ScriptCode /*script*/)))
  413.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(WEReference /*we*/))),
  414.     uppWEEraseProcInfo = kPascalStackBased
  415.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(const Rect * /*area*/)))
  416.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(WEReference /*we*/))),
  417.     uppWEFluxProcInfo = kPascalStackBased
  418.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(SInt32 /*offset*/)))
  419.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt32 /*delta*/)))
  420.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(WEReference /*we*/))),
  421.     uppWENewObjectProcInfo = kPascalStackBased
  422.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  423.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Point * /*defaultObjectSize*/)))
  424.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(WEObjectReference /*obj*/))),
  425.     uppWEDisposeObjectProcInfo = kPascalStackBased
  426.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  427.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(WEObjectReference /*obj*/))),
  428.     uppWEDrawObjectProcInfo = kPascalStackBased
  429.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  430.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(const Rect * /*destRect*/)))
  431.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(WEObjectReference /*obj*/))),
  432.     uppWEClickObjectProcInfo = kPascalStackBased
  433.         | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  434.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Point /*hitPt*/)))
  435.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(EventModifiers /*modifiers*/)))
  436.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(UInt32 /*clickTime*/)))
  437.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(WEObjectReference /*obj*/))),
  438.     uppWEStreamObjectProcInfo = kPascalStackBased
  439.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  440.         | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(SInt16 /*destKind*/)))
  441.         | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(FlavorType * /*theType*/)))
  442.         | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(Handle /*putDataHere*/)))
  443.         | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(WEObjectReference /*obj*/)))
  444. };
  445.  
  446.  
  447. /*    UPPs, New≈Proc macros & Call≈Proc macros */
  448.  
  449. /*
  450.     NOTE:
  451.     For compatibility with the Pascal version, Call≈Proc macros take the form:
  452.  
  453.         CallFooProc(..., userRoutine)
  454.  
  455.     instead of:
  456.  
  457.         CallFooProc(userRoutine, ...)
  458.  
  459. */
  460.  
  461. #if GENERATINGCFM
  462.  
  463. typedef UniversalProcPtr WEClickLoopUPP;
  464. typedef UniversalProcPtr WEScrollUPP;
  465. typedef UniversalProcPtr WETSMPreUpdateUPP;
  466. typedef UniversalProcPtr WETSMPostUpdateUPP;
  467. typedef UniversalProcPtr WEPreTrackDragUPP;
  468. typedef UniversalProcPtr WETranslateDragUPP;
  469. typedef UniversalProcPtr WEHiliteDropAreaUPP;
  470. typedef UniversalProcPtr WEFontIDToNameUPP;
  471. typedef UniversalProcPtr WEFontNameToIDUPP;
  472. typedef UniversalProcPtr WEDrawTextUPP;
  473. typedef UniversalProcPtr WEPixelToCharUPP;
  474. typedef UniversalProcPtr WECharToPixelUPP;
  475. typedef UniversalProcPtr WELineBreakUPP;
  476. typedef UniversalProcPtr WEWordBreakUPP;
  477. typedef UniversalProcPtr WECharByteUPP;
  478. typedef UniversalProcPtr WECharTypeUPP;
  479. typedef UniversalProcPtr WENewObjectUPP;
  480. typedef UniversalProcPtr WEEraseUPP;
  481. typedef UniversalProcPtr WEFluxUPP;
  482. typedef UniversalProcPtr WEDisposeObjectUPP;
  483. typedef UniversalProcPtr WEDrawObjectUPP;
  484. typedef UniversalProcPtr WEClickObjectUPP;
  485. typedef UniversalProcPtr WEStreamObjectUPP;
  486.  
  487. #define NewWEClickLoopProc(userRoutine) \
  488.     (WEClickLoopUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEClickLoopProcInfo, GetCurrentArchitecture())
  489. #define NewWEScrollProc(userRoutine) \
  490.     (WEScrollUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEScrollProcInfo, GetCurrentArchitecture())
  491. #define NewWETSMPreUpdateProc(userRoutine) \
  492.     (WETSMPreUpdateUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWETSMPreUpdateProcInfo, GetCurrentArchitecture())
  493. #define NewWETSMPostUpdateProc(userRoutine) \
  494.     (WETSMPostUpdateUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWETSMPostUpdateProcInfo, GetCurrentArchitecture())
  495. #define NewWEPreTrackDragProc(userRoutine) \
  496.     (WEPreTrackDragUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEPreTrackDragProcInfo, GetCurrentArchitecture())
  497. #define NewWETranslateDragProc(userRoutine) \
  498.     (WETranslateDragUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWETranslateDragProcInfo, GetCurrentArchitecture())
  499. #define NewWEHiliteDropAreaProc(userRoutine) \
  500.     (WEHiliteDropAreaUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEHiliteDropAreaProcInfo, GetCurrentArchitecture())
  501. #define NewWEFontIDToNameProc(userRoutine) \
  502.     (WEFontIDToNameUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEFontIDToNameProcInfo, GetCurrentArchitecture())
  503. #define NewWEFontNameToIDProc(userRoutine) \
  504.     (WEFontNameToIDUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEFontNameToIDProcInfo, GetCurrentArchitecture())
  505. #define NewWEDrawTextProc(userRoutine) \
  506.     (WEDrawTextUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEDrawTextProcInfo, GetCurrentArchitecture())
  507. #define NewWEPixelToCharProc(userRoutine) \
  508.     (WEPixelToCharUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEPixelToCharProcInfo, GetCurrentArchitecture())
  509. #define NewWECharToPixelProc(userRoutine) \
  510.     (WECharToPixelUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWECharToPixelProcInfo, GetCurrentArchitecture())
  511. #define NewWELineBreakProc(userRoutine) \
  512.     (WELineBreakUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWELineBreakProcInfo, GetCurrentArchitecture())
  513. #define NewWEWordBreakProc(userRoutine) \
  514.     (WEWordBreakUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEWordBreakProcInfo, GetCurrentArchitecture())
  515. #define NewWECharByteProc(userRoutine) \
  516.     (WECharByteUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWECharByteProcInfo, GetCurrentArchitecture())
  517. #define NewWECharTypeProc(userRoutine) \
  518.     (WECharTypeUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWECharTypeProcInfo, GetCurrentArchitecture())
  519. #define NewWEEraseProc(userRoutine) \
  520.     (WEEraseUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEEraseProcInfo, GetCurrentArchitecture())
  521. #define NewWEFluxProc(userRoutine) \
  522.     (WEFluxUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEFluxProcInfo, GetCurrentArchitecture())
  523. #define NewWENewObjectProc(userRoutine) \
  524.     (WENewObjectUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWENewObjectProcInfo, GetCurrentArchitecture())
  525. #define NewWEDisposeObjectProc(userRoutine) \
  526.     (WEDisposeObjectUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEDisposeObjectProcInfo, GetCurrentArchitecture())
  527. #define NewWEDrawObjectProc(userRoutine) \
  528.     (WEDrawObjectUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEDrawObjectProcInfo, GetCurrentArchitecture())
  529. #define NewWEClickObjectProc(userRoutine) \
  530.     (WEClickObjectUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEClickObjectProcInfo, GetCurrentArchitecture())
  531. #define NewWEStreamObjectProc(userRoutine) \
  532.     (WEStreamObjectUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEStreamObjectProcInfo, GetCurrentArchitecture())
  533.  
  534. #define CallWEClickLoopProc(we, userRoutine) \
  535.     CallUniversalProc((userRoutine), uppWEClickLoopProcInfo, (we))
  536. #define CallWEScrollProc(we, userRoutine) \
  537.     CallUniversalProc((userRoutine), uppWEScrollProcInfo, (we))
  538. #define CallWETSMPreUpdateProc(we, userRoutine) \
  539.     CallUniversalProc((userRoutine), uppWETSMPreUpdateProcInfo, (we))
  540. #define CallWETSMPostUpdateProc(we, fixLength, inputAreaStart, inputAreaEnd, pinRangeStart, pinRangeEnd, userRoutine) \
  541.     CallUniversalProc((userRoutine), uppWETSMPostUpdateProcInfo, (we), (fixLength), (inputAreaStart), (inputAreaEnd), (pinRangeStart), (pinRangeEnd))
  542. #define CallWEPreTrackDragProc(drag, we, userRoutine) \
  543.     CallUniversalProc((userRoutine), uppWEPreTrackDragProcInfo, (drag), (we))
  544. #define CallWETranslateDragProc(theDrag, theItem, requestedType, putDataHere, dropOffset, we, userRoutine) \
  545.     CallUniversalProc((userRoutine), uppWETranslateDragProcInfo, (theDrag), (theItem), (requestedType), (putDataHere), (dropOffset), (we))
  546. #define CallWEHiliteDropAreaProc(theDrag, hiliteFlag, we, userRoutine) \
  547.     CallUniversalProc((userRoutine), uppWEHiliteDropAreaProcInfo, (theDrag), (hiliteFlag), (we))
  548. #define CallWEFontIDToNameProc(fontID, fontName, userRoutine) \
  549.     CallUniversalProc((userRoutine), uppWEFontIDToNameProcInfo, (fontID), (fontName))
  550. #define CallWEFontNameToIDProc(fontName, oldFontID, newFontID, userRoutine) \
  551.     CallUniversalProc((userRoutine), uppWEFontNameToIDProcInfo, (fontName), (oldFontID), (newFontID))
  552. #define CallWEDrawTextProc(pText, textLength, slop, styleRunPosition, we, userRoutine) \
  553.     CallUniversalProc((userRoutine), uppWEDrawTextProcInfo, (pText), (textLength), (slop), (styleRunPosition), (we))
  554. #define CallWEPixelToCharProc(pText, textLength, slop, pixelWidth, edge, styleRunPosition, hPos, we, userRoutine) \
  555.     CallUniversalProc((userRoutine), uppWEPixelToCharProcInfo, (pText), (textLength), (slop), (pixelWidth), (edge), (styleRunPosition), (hPos), (we))
  556. #define CallWECharToPixelProc(pText, textLength, slop, offset, direction, styleRunPosition, hPos, we, userRoutine) \
  557.     CallUniversalProc((userRoutine), uppWECharToPixelProcInfo, (pText), (textLength), (slop), (offset), (direction), (styleRunPosition), (hPos), (we))
  558. #define CallWELineBreakProc(pText, textLength, textStart, textEnd, textWidth, textOffset, we, userRoutine) \
  559.     CallUniversalProc((userRoutine), uppWELineBreakProcInfo, (pText), (textLength), (textStart), (textEnd), (textWidth), (textOffset), (we))
  560. #define CallWEWordBreakProc(pText, textLength, offset, edge, breakOffsets, script, we, userRoutine) \
  561.     CallUniversalProc((userRoutine), uppWEWordBreakProcInfo, (pText), (textLength), (offset), (edge), (breakOffsets), (script), (we))
  562. #define CallWECharByteProc(pText, textOffset, script, we, userRoutine) \
  563.     CallUniversalProc((userRoutine), uppWECharByteProcInfo, (pText), (textOffset), (script), (we))
  564. #define CallWECharTypeProc(pText, textOffset, script, we, userRoutine) \
  565.     CallUniversalProc((userRoutine), uppWECharTypeProcInfo, (pText), (textOffset), (script), (we))
  566. #define CallWEEraseProc(area, we, userRoutine) \
  567.     CallUniversalProc((userRoutine), uppWEEraseProcInfo, (area), (we))
  568. #define CallWEFluxProc(offset, delta, we, userRoutine) \
  569.     CallUniversalProc((userRoutine), uppWEFluxProcInfo, (offset), (delta), (we))
  570. #define CallWENewObjectProc(defaultObjectSize, obj, userRoutine) \
  571.     CallUniversalProc((userRoutine), uppWENewObjectProcInfo, (defaultObjectSize), (obj))
  572. #define CallWEDisposeObjectProc(obj, userRoutine) \
  573.     CallUniversalProc((userRoutine), uppWEDisposeObjectProcInfo, (obj))
  574. #define CallWEDrawObjectProc(destRect, obj, userRoutine) \
  575.     CallUniversalProc((userRoutine), uppWEDrawObjectProcInfo, (destRect), (obj))
  576. #define CallWEClickObjectProc(hitPt, modifiers, clickTime, obj, userRoutine) \
  577.     CallUniversalProc((userRoutine), uppWEClickObjectProcInfo, (hitPt), (modifiers), (clickTime), (obj))
  578. #define CallWEStreamObjectProc(destKind, theType, putDataHere, obj, userRoutine) \
  579.     CallUniversalProc((userRoutine), uppWEStreamObjectProcInfo, (destKind), (theType), (putDataHere), (obj))
  580.  
  581. #else
  582.  
  583. typedef WEClickLoopProcPtr WEClickLoopUPP;
  584. typedef WEScrollProcPtr WEScrollUPP;
  585. typedef WETSMPreUpdateProcPtr WETSMPreUpdateUPP;
  586. typedef WETSMPostUpdateProcPtr WETSMPostUpdateUPP;
  587. typedef WEPreTrackDragProcPtr WEPreTrackDragUPP;
  588. typedef WETranslateDragProcPtr WETranslateDragUPP;
  589. typedef WEHiliteDropAreaProcPtr WEHiliteDropAreaUPP;
  590. typedef WEFontIDToNameProcPtr WEFontIDToNameUPP;
  591. typedef WEFontNameToIDProcPtr WEFontNameToIDUPP;
  592. typedef WEDrawTextProcPtr WEDrawTextUPP;
  593. typedef WEPixelToCharProcPtr WEPixelToCharUPP;
  594. typedef WECharToPixelProcPtr WECharToPixelUPP;
  595. typedef WELineBreakProcPtr WELineBreakUPP;
  596. typedef WEWordBreakProcPtr WEWordBreakUPP;
  597. typedef WECharByteProcPtr WECharByteUPP;
  598. typedef WECharTypeProcPtr WECharTypeUPP;
  599. typedef WEEraseProcPtr WEEraseUPP;
  600. typedef WEFluxProcPtr WEFluxUPP;
  601. typedef WENewObjectProcPtr WENewObjectUPP;
  602. typedef WEDisposeObjectProcPtr WEDisposeObjectUPP;
  603. typedef WEDrawObjectProcPtr WEDrawObjectUPP;
  604. typedef WEClickObjectProcPtr WEClickObjectUPP;
  605. typedef WEStreamObjectProcPtr WEStreamObjectUPP;
  606.  
  607. #define NewWEClickLoopProc(userRoutine) ((WEClickLoopUPP) (userRoutine))
  608. #define NewWEScrollProc(userRoutine) ((WEScrollUPP) (userRoutine))
  609. #define NewWETSMPreUpdateProc(userRoutine) ((WETSMPreUpdateUPP) (userRoutine))
  610. #define NewWETSMPostUpdateProc(userRoutine) ((WETSMPostUpdateUPP) (userRoutine))
  611. #define NewWEPreTrackDragProc(userRoutine) ((WEPreTrackDragUPP) (userRoutine))
  612. #define NewWETranslateDragProc(userRoutine) ((WETranslateDragUPP) (userRoutine))
  613. #define NewWEHiliteDropAreaProc(userRoutine) ((WEHiliteDropAreaUPP) (userRoutine))
  614. #define NewWEFontIDToNameProc(userRoutine) ((WEFontIDToNameUPP) (userRoutine))
  615. #define NewWEFontNameToIDProc(userRoutine) ((WEFontNameToIDUPP) (userRoutine))
  616. #define NewWEDrawTextProc(userRoutine) ((WEDrawTextUPP) (userRoutine))
  617. #define NewWEPixelToCharProc(userRoutine) ((WEPixelToCharUPP) (userRoutine))
  618. #define NewWECharToPixelProc(userRoutine) ((WECharToPixelUPP) (userRoutine))
  619. #define NewWELineBreakProc(userRoutine) ((WELineBreakUPP) (userRoutine))
  620. #define NewWEWordBreakProc(userRoutine) ((WEWordBreakUPP) (userRoutine))
  621. #define NewWECharByteProc(userRoutine) ((WECharByteUPP) (userRoutine))
  622. #define NewWECharTypeProc(userRoutine) ((WECharTypeUPP) (userRoutine))
  623. #define NewWEEraseProc(userRoutine) ((WEEraseUPP) (userRoutine))
  624. #define NewWEFluxProc(userRoutine) ((WEFluxUPP) (userRoutine))
  625. #define NewWENewObjectProc(userRoutine) ((WENewObjectUPP) (userRoutine))
  626. #define NewWEDisposeObjectProc(userRoutine) ((WEDisposeObjectUPP) (userRoutine))
  627. #define NewWEDrawObjectProc(userRoutine) ((WEDrawObjectUPP) (userRoutine))
  628. #define NewWEClickObjectProc(userRoutine) ((WEClickObjectUPP) (userRoutine))
  629. #define NewWEStreamObjectProc(userRoutine) ((WEStreamObjectUPP) (userRoutine))
  630.  
  631. #define CallWEClickLoopProc(we, userRoutine) \
  632.     (*(userRoutine))((we))
  633. #define CallWEScrollProc(we, userRoutine) \
  634.     (*(userRoutine))((we))
  635. #define CallWETSMPreUpdateProc(we, userRoutine) \
  636.     (*(userRoutine))((we))
  637. #define CallWETSMPostUpdateProc(we, fixLength, inputAreaStart, inputAreaEnd, pinRangeStart, pinRangeEnd, userRoutine) \
  638.     (*(userRoutine))((we), (fixLength), (inputAreaStart), (inputAreaEnd), (pinRangeStart), (pinRangeEnd))
  639. #define CallWEPreTrackDragProc(drag, we, userRoutine) \
  640.     (*(userRoutine))((drag), (we))
  641. #define CallWETranslateDragProc(theDrag, theItem, requestedType, putDataHere, dropOffset, we, userRoutine) \
  642.     (*(userRoutine))((theDrag), (theItem), (requestedType), (putDataHere), (dropOffset), (we))
  643. #define CallWEHiliteDropAreaProc(theDrag, hiliteFlag, we, userRoutine) \
  644.     (*(userRoutine))((theDrag), (hiliteFlag), (we))
  645. #define CallWEFontIDToNameProc(fontID, fontName, userRoutine) \
  646.     (*(userRoutine))((fontID), (fontName))
  647. #define CallWEFontNameToIDProc(fontName, oldFontID, newFontID, userRoutine) \
  648.     (*(userRoutine))((fontName), (oldFontID), (newFontID))
  649. #define CallWEDrawTextProc(pText, textLength, slop, styleRunPosition, we, userRoutine) \
  650.     (*(userRoutine))((pText), (textLength), (slop), (styleRunPosition), (we))
  651. #define CallWEPixelToCharProc(pText, textLength, slop, pixelWidth, edge, styleRunPosition, hPos, we, userRoutine) \
  652.     (*(userRoutine))((pText), (textLength), (slop), (pixelWidth), (edge), (styleRunPosition), (hPos), (we))
  653. #define CallWECharToPixelProc(pText, textLength, slop, offset, direction, styleRunPosition, hPos, we, userRoutine) \
  654.     (*(userRoutine))((pText), (textLength), (slop), (offset), (direction), (styleRunPosition), (hPos), (we))
  655. #define CallWELineBreakProc(pText, textLength, textStart, textEnd, textWidth, textOffset, we, userRoutine) \
  656.     (*(userRoutine))((pText), (textLength), (textStart), (textEnd), (textWidth), (textOffset), (we))
  657. #define CallWEWordBreakProc(pText, textLength, offset, edge, breakOffsets, script, we, userRoutine) \
  658.     (*(userRoutine))((pText), (textLength), (offset), (edge), (breakOffsets), (script), (we))
  659. #define CallWECharByteProc(pText, textOffset, script, we, userRoutine) \
  660.     (*(userRoutine))((pText), (textOffset), (script), (we))
  661. #define CallWECharTypeProc(pText, textOffset, script, we, userRoutine) \
  662.     (*(userRoutine))((pText), (textOffset), (script), (we))
  663. #define CallWEEraseProc(area, we, userRoutine) \
  664.     (*(userRoutine))((area), (we))
  665. #define CallWEFluxProc(offset, delta, we, userRoutine) \
  666.     (*(userRoutine))((offset), (delta), (we))
  667. #define CallWENewObjectProc(defaultObjectSize, obj, userRoutine) \
  668.     (*(userRoutine))((defaultObjectSize), (obj))
  669. #define CallWEDisposeObjectProc(obj, userRoutine) \
  670.     (*(userRoutine))((obj))
  671. #define CallWEDrawObjectProc(destRect, obj, userRoutine) \
  672.     (*(userRoutine))((destRect), (obj))
  673. #define CallWEClickObjectProc(hitPt, modifiers, clickTime, obj, userRoutine) \
  674.     (*(userRoutine))((hitPt), (modifiers), (clickTime), (obj))
  675. #define CallWEStreamObjectProc(destKind, theType, putDataHere, obj, userRoutine) \
  676.     (*(userRoutine))((destKind), (theType), (putDataHere), (obj))
  677.  
  678. #endif
  679.  
  680.  
  681. /*    WASTE public calls */
  682.  
  683. /*    getting the shared library version number */
  684.  
  685. extern pascal UInt32 /* NumVersion */ WEVersion(void);
  686.  
  687. /*    creation and destruction */
  688.  
  689. extern pascal OSErr WENew(const LongRect *destRect, const LongRect *viewRect, UInt32 flags, WEReference *we);
  690. extern pascal void WEDispose(WEReference we);
  691.  
  692. /*    getting variables */
  693.  
  694. extern pascal Handle WEGetText(WEReference we);
  695. extern pascal SInt16 WEGetChar(SInt32 offset, WEReference we);
  696. extern pascal SInt32 WEGetTextLength(WEReference we);
  697. extern pascal SInt32 WEGetHeight(SInt32 startLine, SInt32 endLine, WEReference we);
  698. extern pascal void WEGetSelection(SInt32 *selStart, SInt32 *selEnd, WEReference we);
  699. extern pascal void WEGetDestRect(LongRect *destRect, WEReference we);
  700. extern pascal void WEGetViewRect(LongRect *viewRect, WEReference we);
  701. extern pascal Boolean WEIsActive(WEReference we);
  702. extern pascal SInt32 WEOffsetToLine(SInt32 offset, WEReference we);
  703. extern pascal void WEGetLineRange(SInt32 lineIndex, SInt32 *lineStart, SInt32 *lineEnd, WEReference we);
  704. extern pascal SInt32 WECountLines(WEReference we);
  705. extern pascal SInt32 WEOffsetToRun(SInt32 offset, WEReference we);
  706. extern pascal void WEGetRunRange(SInt32 runIndex, SInt32 *runStart, SInt32 *runEnd, WEReference we);
  707. extern pascal SInt32 WECountRuns(WEReference we);
  708. extern pascal UInt16 WEGetClickCount(WEReference we);
  709.  
  710. /*    setting variables */
  711.  
  712. extern pascal void WESetSelection(SInt32 selStart, SInt32 selEnd, WEReference we);
  713. extern pascal void WESetDestRect(const LongRect *destRect, WEReference we);
  714. extern pascal void WESetViewRect(const LongRect *viewRect, WEReference we);
  715.  
  716. /*    accessing style run information */
  717.  
  718. extern pascal Boolean WEContinuousStyle(WEStyleMode *mode, TextStyle *ts, WEReference we);
  719. extern pascal void WEGetRunInfo(SInt32 offset, WERunInfo *runInfo, WEReference we);
  720. extern pascal Boolean WEGetRunDirection(SInt32 offset, WEReference we);
  721.  
  722. /*    converting byte offsets to screen position and vice versa */
  723.  
  724. extern pascal SInt32 WEGetOffset(const LongPt *thePoint, WEEdge *edge, WEReference we);
  725. extern pascal void WEGetPoint(SInt32 offset, SInt16 direction, LongPt *thePoint, SInt16 *lineHeight, WEReference we);
  726.  
  727. /*    finding words, lines and paragraphs */
  728.  
  729. extern pascal void WEFindWord(SInt32 offset, WEEdge edge, SInt32 *wordStart, SInt32 *wordEnd, WEReference we);
  730. extern pascal void WEFindLine(SInt32 offset, WEEdge edge, SInt32 *lineStart, SInt32 *lineEnd, WEReference we);
  731. extern pascal void WEFindParagraph(SInt32 offset, WEEdge edge, SInt32 *paragraphStart, SInt32 *paragraphEnd, WEReference we);
  732.  
  733. /*    making a copy of a text range */
  734.  
  735. extern pascal OSErr WECopyRange(SInt32 rangeStart, SInt32 rangeEnd, Handle hText, StScrpHandle hStyles, WESoupHandle hSoup, WEReference we);
  736.  
  737. /*    getting and setting the alignment style */
  738.  
  739. extern pascal WEAlignment WEGetAlignment(WEReference we);
  740. extern pascal void WESetAlignment(WEAlignment alignment, WEReference we);
  741.  
  742. /*    getting and setting the primary line direction */
  743.  
  744. extern pascal WEDirection WEGetDirection(WEReference we);
  745. extern pascal void WESetDirection(WEDirection direction, WEReference we);
  746.  
  747. /*    recalculating line breaks, drawing and scrolling */
  748.  
  749. extern pascal OSErr WECalText(WEReference we);
  750. extern pascal void WEUpdate(RgnHandle updateRgn, WEReference we);
  751. extern pascal void WEScroll(SInt32 hOffset, SInt32 vOffset, WEReference we);
  752. extern pascal void WESelView(WEReference we);
  753.  
  754. /*    handling activate / deactivate events */
  755.  
  756. extern pascal void WEActivate(WEReference we);
  757. extern pascal void WEDeactivate(WEReference we);
  758.  
  759. /*     handling key-down events */
  760.  
  761. extern pascal void WEKey(SInt16 key, EventModifiers modifiers, WEReference we);
  762.  
  763. /*    handling mouse-down events and mouse tracking */
  764.  
  765. extern pascal void WEClick(Point hitPt, EventModifiers modifiers, UInt32 clickTime, WEReference we);
  766.  
  767. /*    adjusting the cursor shape */
  768.  
  769. extern pascal Boolean WEAdjustCursor(Point mouseLoc, RgnHandle mouseRgn, WEReference we);
  770.  
  771. /*    blinking the caret */
  772.  
  773. extern pascal void WEIdle(UInt32 *maxSleep, WEReference we);
  774.  
  775. /*    modifying the text and the styles */
  776.  
  777. extern pascal OSErr WEInsert(const void *pText, SInt32 textLength, StScrpHandle hStyles, WESoupHandle hSoup, WEReference we);
  778. extern pascal OSErr WEDelete(WEReference we);
  779. extern pascal OSErr WESetStyle(WEStyleMode mode, const TextStyle *ts, WEReference we);
  780. extern pascal OSErr WEUseStyleScrap(StScrpHandle hStyles, WEReference we);
  781. extern pascal OSErr WEUseText(Handle hText, WEReference we);
  782.  
  783. /*    undo */
  784.  
  785. extern pascal OSErr WEUndo(WEReference we);
  786. extern pascal void WEClearUndo(WEReference we);
  787. extern pascal WEActionKind WEGetUndoInfo(Boolean *redoFlag, WEReference we);
  788. extern pascal Boolean WEIsTyping(WEReference we);
  789. extern pascal OSErr WEBeginAction(WEReference we);
  790. extern pascal OSErr WEEndAction(WEActionKind actionKind, WEReference we);
  791.  
  792. /*    keeping track of changes */
  793.  
  794. extern pascal UInt32 WEGetModCount(WEReference we);
  795. extern pascal void WEResetModCount(WEReference we);
  796.  
  797. /*    embedded objects */
  798.  
  799. extern pascal OSErr WEInstallObjectHandler(FlavorType objectType, WESelector handlerSelector, UniversalProcPtr handler, WEReference we);
  800. extern pascal OSErr WEGetObjectHandler(FlavorType objectType, WESelector handlerSelector, UniversalProcPtr *handler, WEReference we);
  801. extern pascal OSErr WEInsertObject(FlavorType objectType, Handle objectDataHandle, Point objectSize, WEReference we);
  802. extern pascal OSErr WEGetSelectedObject(WEObjectReference *obj, WEReference we);
  803. extern pascal SInt32 WEFindNextObject(SInt32 offset, WEObjectReference *obj, WEReference we);
  804. extern pascal OSErr WEUseSoup(WESoupHandle hSoup, WEReference we);
  805.  
  806. /*    accessing embedded object attributes */
  807.  
  808. extern pascal FlavorType WEGetObjectType(WEObjectReference obj);
  809. extern pascal Handle WEGetObjectDataHandle(WEObjectReference obj);
  810. extern pascal Point WEGetObjectSize(WEObjectReference obj);
  811. extern pascal WEReference WEGetObjectOwner(WEObjectReference obj);
  812. extern pascal SInt32 WEGetObjectRefCon(WEObjectReference obj);
  813. extern pascal void WESetObjectRefCon(WEObjectReference obj, SInt32 refCon);
  814.  
  815. /*    clipboard operations */
  816.  
  817. extern pascal OSErr WECut(WEReference we);
  818. extern pascal OSErr WECopy(WEReference we);
  819. extern pascal OSErr WEPaste(WEReference we);
  820. extern pascal Boolean WECanPaste(WEReference we);
  821.  
  822. /*    Drag Manager support */
  823.  
  824. extern pascal RgnHandle WEGetHiliteRgn(SInt32 rangeStart, SInt32 rangeEnd, WEReference we);
  825. extern pascal OSErr WETrackDrag(DragTrackingMessage message, DragReference drag, WEReference we);
  826. extern pascal OSErr WEReceiveDrag(DragReference drag, WEReference we);
  827. extern pascal Boolean WECanAcceptDrag(DragReference drag, WEReference we);
  828. extern pascal Boolean WEDraggedToTrash(DragReference drag);
  829.  
  830. /*    font tables */
  831.  
  832. extern pascal OSErr WEBuildFontTable(WEFontTableHandle hFontTable, WEFontIDToNameUPP fontIDToNameProc, WEReference we);
  833. extern pascal OSErr WEUpdateFontTable(WEFontTableHandle hFontTable, WEFontNameToIDUPP fontNameToIDProc, Boolean *wasChanged);
  834. extern pascal OSErr WEUpdateStyleScrap(StScrpHandle hStyles, WEFontTableHandle hFontTable);
  835.  
  836. /*    Script Manager utilities */
  837.  
  838. extern pascal SInt16 WECharByte(SInt32 offset, WEReference we);
  839. extern pascal SInt16 WECharType(SInt32 offset, WEReference we);
  840.  
  841. /*    Text Services Manager support */
  842.  
  843. extern pascal OSErr WEInstallTSMHandlers(void);
  844. extern pascal OSErr WERemoveTSMHandlers(void);
  845. extern pascal OSErr WEHandleTSMEvent(const AppleEvent *ae, AppleEvent *reply);
  846. extern pascal void WEStopInlineSession(WEReference we);
  847.  
  848. /*    additional features */
  849.  
  850. extern pascal SInt16 WEFeatureFlag(SInt16 feature, SInt16 action, WEReference we);
  851. extern pascal OSErr WEGetInfo(WESelector selector, void *info, WEReference we);
  852. extern pascal OSErr WESetInfo(WESelector selector, const void *info, WEReference we);
  853.  
  854. /*    getting and setting user-defined info */
  855.  
  856. extern pascal OSErr WEGetUserInfo(WESelector tag, SInt32 *userInfo, WEReference we);
  857. extern pascal OSErr WESetUserInfo(WESelector tag, SInt32 userInfo, WEReference we);
  858.  
  859. /*    long coordinate utilities */
  860.  
  861. extern pascal void WELongPointToPoint(const LongPt *lp, Point *p);
  862. extern pascal void WEPointToLongPoint(Point p, LongPt *lp);
  863. extern pascal void WESetLongRect(LongRect *lr, SInt32 left, SInt32 top, SInt32 right, SInt32 bottom);
  864. extern pascal void WELongRectToRect(const LongRect *lr, Rect *r);
  865. extern pascal void WERectToLongRect(const Rect *r, LongRect *lr);
  866. extern pascal void WEOffsetLongRect(LongRect *lr, SInt32 hOffset, SInt32 vOffset);
  867. extern pascal Boolean WELongPointInLongRect(const LongPt *lp, const LongRect *lr);
  868.  
  869. #if PRAGMA_IMPORT_SUPPORTED
  870. #pragma import off
  871. #endif
  872.  
  873. #if PRAGMA_ALIGN_SUPPORTED
  874. #pragma options align=reset
  875. #endif
  876.  
  877. #ifdef __cplusplus
  878. }
  879. #endif
  880.  
  881. #endif    /* _WASTE_ */
  882.